//
//  DetailTableViewCell.m
//  Daybook
//
//  Created by dllo on 16/5/21.
//  Copyright © 2016年 zhangbin. All rights reserved.
//

#import "DetailTableViewCell.h"
#import "Common.h"

#define CELL_TEXT_COLOR  [UIColor lightGrayColor]

@interface DetailTableViewCell ()

@end
@implementation DetailTableViewCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        [self createView];
    }
    return self;
}

- (void)createView {
    self.dayLabel = ({
        UILabel *tempLabel = [[UILabel alloc] init];
        [self.contentView addSubview:tempLabel];
        tempLabel.textAlignment = NSTextAlignmentCenter;
        tempLabel.font = [UIFont systemFontOfSize:20];
        tempLabel.textColor = CELL_TEXT_COLOR;
        tempLabel;
    });
    
    self.weekendLabel = ({
        UILabel *tempLabel = [[UILabel alloc] init];
        [self.contentView addSubview:tempLabel];
        tempLabel.textAlignment = NSTextAlignmentCenter;
        tempLabel.font = [UIFont systemFontOfSize:12];
        tempLabel.textColor = CELL_TEXT_COLOR;
        tempLabel;
    });
    
    self.picImageView = ({
        UIImageView *tempImageView = [UIImageView new];
        tempImageView.layer.cornerRadius = [CalculateFrameView setHeight:25];
        tempImageView.layer.masksToBounds = YES;
        [self.contentView addSubview:tempImageView];
        tempImageView;
    });
    
    self.firstStyleTitleLabel = ({
        UILabel *tempLabel = [[UILabel alloc] init];
        [self.contentView addSubview:tempLabel];
        tempLabel.textAlignment = NSTextAlignmentLeft;
        tempLabel.font = [UIFont systemFontOfSize:16];
        tempLabel.textColor = BLACK_COLOR;
        tempLabel;
    });
    
    self.moneyLabel = ({
        UILabel *tempLabel = [[UILabel alloc] init];
        [self.contentView addSubview:tempLabel];
        tempLabel.textAlignment = NSTextAlignmentRight;
        tempLabel.font = [UIFont systemFontOfSize:16];
        tempLabel.textColor = [UIColor greenColor];
        tempLabel;
    });
    
    self.secondStyleTitleLabel = ({
        UILabel *tempLabel = [[UILabel alloc] init];
        [self.contentView addSubview:tempLabel];
        tempLabel.textAlignment = NSTextAlignmentLeft;
        tempLabel.font = [UIFont systemFontOfSize:15];
        tempLabel.textColor = BLACK_COLOR;
        tempLabel;
    });
    
    self.commentLabel = ({
        UILabel *tempLabel = [[UILabel alloc] init];
        [self.contentView addSubview:tempLabel];
        tempLabel.textAlignment = NSTextAlignmentLeft;
        tempLabel.font = [UIFont systemFontOfSize:15];
        tempLabel.textColor = CELL_TEXT_COLOR;
        tempLabel;
    });
    
    self.lineView = [[UIView alloc] init];
    [self.contentView addSubview:_lineView];
    _lineView.backgroundColor = LINE_COLOR;
    self.lineView.hidden = YES;
    
}

- (void)layoutSubviews {
    [super layoutSubviews];
    self.dayLabel.frame = CGRectMake([CalculateFrameView setWidth:14], [CalculateFrameView setHeight:8], 30 / 414.0 * MAIN_WIDTH, 25 / 414.0 * MAIN_WIDTH);
    self.weekendLabel.frame = CGRectMake([CalculateFrameView setWidth:8], [CalculateFrameView setHeight:28], 45 / 414.0 * MAIN_WIDTH, 25 / 414.0 * MAIN_WIDTH);
    self.picImageView.frame = CGRectMake([CalculateFrameView setWidth:60], [CalculateFrameView setHeight:5], 50 / 414.0 * MAIN_WIDTH, 50 / 414.0 * MAIN_WIDTH);
    self.firstStyleTitleLabel.frame = CGRectMake([CalculateFrameView setWidth:120], [CalculateFrameView setHeight:10], 170 / 414.0 * MAIN_WIDTH, 40 / 414.0 * MAIN_WIDTH);
    self.moneyLabel.frame = CGRectMake([CalculateFrameView setWidth:270], [CalculateFrameView setHeight:10], 120 / 414.0 * MAIN_WIDTH, 40 / 414.0 * MAIN_WIDTH);
    self.secondStyleTitleLabel.frame = CGRectMake([CalculateFrameView setWidth:120], [CalculateFrameView setHeight:5], 170 / 414.0 * MAIN_WIDTH, 25 / 414.0 * MAIN_WIDTH);
    self.commentLabel.frame = CGRectMake([CalculateFrameView setWidth:120], [CalculateFrameView setHeight:29], 170 / 414.0 * MAIN_WIDTH, 25 / 414.0 * MAIN_WIDTH);
    self.lineView.frame = CGRectMake(0, self.contentView.frame.size.height - 1, MAIN_WIDTH, 1);
}


@end
